package com.wly.datapool.heropool;

import java.util.ArrayList;

import com.wly.datapool.heropool.hero.BaseHero;
import com.wly.datapool.heropool.hero.Hero;
import com.wly.datapool.heropool.hero.HeroStatic;
import com.wly.define.IDZoneDefine;

public class HeroStaticPool
{
	private ArrayList<HeroStatic> _heroArr;
	private static HeroStaticPool _instance;
	
	private HeroStaticPool()
	{
		initHeros();
	}
	
	static public HeroStaticPool getInstance()
	{
		if(_instance == null)
		{
			_instance = new HeroStaticPool();
		}
		return _instance;
	}
	
	public ArrayList<HeroStatic> getHeroList()
	{
		return _heroArr;
	}
	
	private void initHeros()
	{
		HeroStatic heroBaseInfo;
		_heroArr = new ArrayList<HeroStatic>();
	}
	
	public HeroStatic getHeroByHeroId(int id)
	{
		return _heroArr.get(id);
	}
	
	public HeroStatic getHeroByTempleteId(int id)
	{
		return _heroArr.get(id-IDZoneDefine.HERO_START_ID);
	}
	
	static public BaseHero createNewHero(int heroId)
	{
		BaseHero hero = new Hero(heroId);
		return hero;
	}
}
